<!DOCTYPE html>
<html class="x-admin-sm">

    <head>
        <meta charset="UTF-8">
        <title>公告列表</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width">
        <link rel="stylesheet" href="./css/font.css">
        <link rel="stylesheet" href="./css/xadmin.css">
        <link href="//unpkg.com/layui@2.9.14/dist/css/layui.css" rel="stylesheet">
        <script src="./lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="./js/xadmin.js"></script>
        <!--[if lt IE 9]>
          <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
          <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
        <script src="./js/jquery.js"></script>
        <script src="./js/common/ajaxUse.js"></script>
        <script src="js/common/FilterExampleQuery.js"></script>
    </head>

    <body>
        <div class="x-nav">
            <span class="layui-breadcrumb">
                <a href="">首页</a>
                <a href="">公告管理</a>
                <a>
                    <cite>公告列表</cite></a>
            </span>
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
                <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
            </a>
        </div>
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card" >

                        <div class="layui-card-body FilterParent">
                            <div class="layui-inline layui-show-xs-block">
                                <button class="layui-btn"  lay-submit="" lay-filter="search"><i class="layui-icon" onclick="submit('/search/exampleQuery',NotExampleQuery(8))">重置列表</i></button>
                                <button class="layui-btn"  lay-submit="" lay-filter="search"><i class="layui-icon" onclick="addFilter()">新增筛选</i></button>
                                <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon" onclick="submit('/search/exampleQuery',getExamples(8))">&#xe615;</i></button>
                            </div>
                            <div class="layui-collapse Filter" lay-filter="test">
                                <div class="layui-colla-item">
                                    <h2 class="layui-colla-title">条件筛选
                                        <a title="删除" onclick="deleteFilter(this.parentElement.parentElement.parentElement)" href="javascript:;">
                                            <i class="layui-icon">&#xe640;</i></a></h2>
                                    <div class="layui-colla-content">
                                        <form class="layui-form" action="">

                                            <div class="layui-form-item" style="display: inline-block; margin-right: 10px;">
                                                <label for="nTag" class="layui-form-label">
                                                    关键词
                                                </label>
                                                <div class="layui-input-inline" id="nTag">
                                                    <input type="text" name="nTag" autocomplete="off" class="layui-input">
                                                </div>
                                            </div>
                                            <div class="layui-form-item" style="display: inline-block; margin-right: 10px;">
                                                <label for="nPublishDate" class="layui-form-label">
                                                    发布日期
                                                </label>
                                                <div class="layui-input-inline" id="nPublishDate">
                                                    <input class="layui-input"  autocomplete="off" name="nPublishDate" type="date">
                                                </div>
                                            </div>

                                            <div class="layui-form-item" style="display: inline-block; margin-right: 10px;">
                                                <label for="nTitle" class="layui-form-label">
                                                    公告标题
                                                </label>
                                                <div class="layui-input-inline" id="nTitle">
                                                    <input class="layui-input"  autocomplete="off" name="nTitle" type="text">
                                                </div>
                                            </div>
                                            <div class="layui-form-item" style="display: inline-block; margin-right: 10px;">
                                                <label for="nTitle" class="layui-form-label">
                                                    公告内容
                                                </label>
                                                <div class="layui-input-inline" id="nContent">
                                                    <input class="layui-input"  autocomplete="off" name="nContent" type="text">
                                                </div>
                                            </div>
                                            <div class="layui-form-item" style="display: inline-block; margin-right: 10px;">
                                                <label for="nTarget" class="layui-form-label">
                                                    接收方
                                                </label>
                                                <div class="layui-input-inline" id="nTarget">
                                                    <input class="layui-input"  autocomplete="off" name="nTarget" type="number">
                                                </div>
                                            </div>
                                            <div class="layui-form-item" style="display: inline-block; margin-right: 10px;">
                                                <label for="nGrade" class="layui-form-label">
                                                    重要等级
                                                </label>
                                                <div class="layui-input-inline" id="nGrade">
                                                    <input class="layui-input"  autocomplete="off" name="nGrade" type="number">
                                                </div>
                                            </div>
                                            <div class="layui-form-item" style="display: inline-block; margin-right: 10px;">
                                                <label for="nCategory" class="layui-form-label">
                                                    公告种类
                                                </label>
                                                <div class="layui-input-inline" id="nCategory">
                                                    <input class="layui-input"  autocomplete="off" name="nCategory" type="text">
                                                </div>
                                            </div>
                                            <div class="layui-form-item" style="display: inline-block; margin-right: 10px;">
                                                <label for="nAdminId" class="layui-form-label">
                                                    管理员编号
                                                </label>
                                                <div class="layui-input-inline" id="nAdminId">
                                                    <input class="layui-input"  autocomplete="off" name="nAdminId" type="number">
                                                </div>
                                            </div>
                                            <div class="layui-form-item" style="display: inline-block; margin-right: 10px;">
                                                <label for="nStatus" class="layui-form-label">
                                                    状态
                                                </label>
                                                <div class="layui-input-inline" id="nStatus">
                                                    <input type="radio" name="nStatus" value=2 title="已发布">
                                                    <input type="radio" name="nStatus" value=1 title="已关闭">
                                                </div>
                                            </div>
                                            <div class="layui-form-item">
                                                <div class="layui-input-block">
                                                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                                </div>
                                            </div>
                                        </form>

                                    </div>
                                </div>
                            </div>

                        </div>
                        <div id="FilterDisplayContainer"></div>
                        <div class="layui-card-header">
                            <button class="layui-btn" onclick="xadmin.open('发布公告','notice-add.html',800,600)">
                                <i class="layui-icon" onclick="">添加</i></button>
                                </div>
                        <div class="layui-card-table ">
                            <table class="layui-table layui-form data-list">
                                <thead>
                                    <tr>
                                        <th>
                                            <input type="checkbox" name="" lay-filter="checkall" lay-skin="primary"></th>
                                        <th>公告编号</th>
                                        <th>发布日期</th>
                                        <th>公告标题</th>
                                        <th>公告内容</th>
                                        <th>接收方 <i id="id1" class="layui-icon layui-icon-about" onmouseover="show('4-管理员 2-工作人员 1-用户      相加和即为接收方','id1')" onmouseleave="close_tips()"></i></th>
                                        <th>重要等级</th>
                                        <th>状态</th>
                                        <th>公告种类</th>
                                        <th>关键词</th>
                                        <th>发布管理员id</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
    <script>
        submit('/search/exampleQuery',NotExampleQuery(8))

        function show(msg, id) {
            layer.tips('' + msg, '#' + id, { tips: [2, 'black'] });
        }
        function close_tips() {
            layer.closeAll('tips');
        }
        function doAction (data) {
            layer.open({
                type: 2,
                title: '修改数据', //ifrem的标题
                maxmin: true, //最小化
                shadeClose: true, //点击遮罩关闭层
                area: ['80%', '80%'], //大小
                content: 'notice-edit.html',//打开的url
                success: function (layero, index) {
                    var body=layer.getChildFrame('body',index);
                    body.contents().find('#nId').val(data.childNodes.item(3).innerHTML);
                    body.contents().find('#nTitle').val(data.childNodes.item(7).innerHTML);
                    body.contents().find('#nContent').val(data.childNodes.item(9).innerHTML);
                    body.contents().find('#nTarget').val(data.childNodes.item(11).innerHTML);
                    body.contents().find('#nGrade').val(data.childNodes.item(13).innerHTML);
                    if(data.childNodes.item(15).innerHTML === '已发布')
                    {
                        select = 'dd[lay-value=\'2\']'
                    }else {
                            select = 'dd[lay-value=\'1\']'
                    }
                    body.contents().find('#nStatus').siblings("div.layui-form-select").find('dl').find(select).click();
                    // body.contents().find('#nStatus').val(data.childNodes.item(15).innerHTML);
                    body.contents().find('#nCategory').val(data.childNodes.item(17).innerHTML);
                    body.contents().find('#nTag').val(data.childNodes.item(19).innerHTML);
                }
            })
        }

        layui.use(['laydate', 'form'],
        function() {
            var laydate = layui.laydate;
            //执行一个laydate实例
            laydate.render({
                elem: '#start' //指定元素
            });
            //执行一个laydate实例
            laydate.render({
                elem: '#end' //指定元素
            });
        });

        /*用户-删除*/
        function member_del(obj, id) {
            id = obj.parentElement.parentElement.childNodes.item(3).textContent;
            layer.confirm('确认要删除吗？',function(index){
                submit("/Notice/deleteNotice",JSON.stringify({type:0,nId:id}))
                //发异步删除数据
                $(obj).parents("tr").remove();
            });
        }
    </script>
</html>